
Filtering Indels by length
• BCFtools can be used to easily filter Indels by length using ”ILEN”
• ILEN will count up the length of the indel for you: positive numbers
are for insertions, and negative are deletions.
# To remove indels smaller than 5bp:
bcftools view -i '(ILEN >= -5 && ILEN <= 5)’
TYPE is a built-in that will determine whether a variant is an indel, snp,
etc. on-the-fly, so you can use the OR logic to include variants that
aren't indels (i.e. snps) using the second command. Note that
otherwise, ILEN explicitly excludes anything that's not an indel.
# To remove indels smaller than 5bp and preserve SNPs
Bcftools view -i '(ILEN >= -5 && ILEN <= 5) || TYPE!="INDEL”’